Skip to content

Adding New Check: Schema Validation check#568

Merged
mwojtyczka merged 20 commits into
mainfrom
schema_validation
Sep 17, 2025
Merged

Adding New Check: Schema Validation check#568
mwojtyczka merged 20 commits into
mainfrom
schema_validation

Conversation

@ghanse

@ghanse ghanse commented Sep 5, 2025

Copy link
Copy Markdown
Collaborator

Changes

Introduces the dataset-level check function has_valid_schema, which validates that a DataFrame conforms to the specified schema.

Results are reported in the same format as other checks, i.e., at the row level. While this results in duplicated messages (since the same validation outcome is repeated for all rows), it ensures consistency on how quality issues are reported.

Linked issues

Resolves #159

Tests

  • manually tested
  • added unit tests
  • added integration tests
  • added end-to-end tests
  • added performance tests

@ghanse
ghanse requested a review from a team as a code owner September 5, 2025 21:40
@ghanse
ghanse requested review from tombonfert and removed request for a team September 5, 2025 21:40
@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

✅ 307/307 passed, 4 flaky, 1 skipped, 2h56m9s total

Flaky tests:

  • 🤪 test_profile_tables_with_common_opts (1.346s)
  • 🤪 test_quality_checker_workflow_with_custom_check_func_rel_path (2m18.883s)
  • 🤪 test_e2e_workflow (10m58.404s)
  • 🤪 test_e2e_workflow (8m31.962s)

Running from acceptance #2365

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the dataset-level check function has_valid_schema to validate that the checked DataFrame matches the specified schema. The function supports both permissive and strict validation modes, with optional column filtering.

  • Adds has_valid_schema function with schema validation logic and type compatibility checking
  • Implements comprehensive test coverage including unit, integration, and performance tests
  • Updates documentation with usage examples and parameter descriptions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/perf/test_apply_checks.py Adds performance tests for schema validation checks
tests/perf/.benchmarks/baseline.json Updates baseline performance metrics with new schema validation benchmarks
tests/integration/test_dataset_checks.py Adds comprehensive integration tests covering various schema validation scenarios
src/databricks/labs/dqx/llm/resources/yaml_checks_examples.yml Adds YAML configuration examples for schema validation checks
src/databricks/labs/dqx/check_funcs.py Implements the core schema validation functionality and helper functions
docs/dqx/docs/reference/quality_checks.mdx Updates documentation with schema validation check reference and examples
docs/dqx/docs/reference/benchmarks.mdx Updates benchmark results to include schema validation performance metrics

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/integration/test_dataset_checks.py
Comment thread src/databricks/labs/dqx/check_funcs.py
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread docs/dqx/docs/reference/quality_checks.mdx Outdated
Comment thread docs/dqx/docs/reference/quality_checks.mdx Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread src/databricks/labs/dqx/check_funcs.py
Comment thread src/databricks/labs/dqx/check_funcs.py
Comment thread src/databricks/labs/dqx/check_funcs.py
Comment thread tests/integration/test_dataset_checks.py
Comment thread src/databricks/labs/dqx/check_funcs.py Outdated
Comment thread docs/dqx/docs/reference/quality_checks.mdx Outdated
Comment thread docs/dqx/docs/reference/quality_checks.mdx Outdated

@mwojtyczka mwojtyczka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mwojtyczka mwojtyczka mentioned this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Schema validation check

3 participants